package com.feri.redromance01.controller;

import com.feri.redromance01.entity.Deparement;
import com.feri.redromance01.service.intf.DeparementService;
import com.feri.redromance01.vo.PageBean;
import com.feri.redromance01.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @autor wfl
 * @time 2022/8/30
 */
@RestController
@RequestMapping("/api/dep/")
public class DeparementController {
    @Autowired
    private DeparementService service;
    @PostMapping("add.do")
    public R add(Deparement deparement){
        return service.add(deparement);
    }
    @GetMapping("delete.do")
    public R delete(int id) {
        return service.delete(id);
    }
    @PostMapping("update.do")
    public R update(Deparement deparement) {
        return service.update(deparement);
    }
    //查询
    @GetMapping("page.do")
    public PageBean page(String name, int page, int limit){
        return service.selectPage(name,page,limit);
    }
}
